#ifndef __SEMANTIC_H__
#define __SEMANTIC_H__

#include "table.h"
#include "treenode.h"
#include "Err.h"

extern symbolTable* top;

void printSemMsg(int errid, int lineno, const char* msg);
bool cmp(treenode* node, const char* str);
char* getStructTmpName();
bool isDupInMempara(char* name, mempara* mp);

void parseProgram(treenode* node);
void parseExtDefList(treenode* node);
void parseExtDef(treenode* node);
attri* parseSpecifier(treenode* node);
void parseExtDecList(treenode* node, attri* val);
mempara* parseFunDec(treenode* node, attri* val, bool* error);
void parseCompSt(treenode* node, mempara* paraAttri, attri* retType);
attri* parseStructSpecifier(treenode* node);
void parseStructDefList(treenode* node, mempara** memAttri);
void parseStructDef(treenode* node, mempara** memAttri);
void parseStructDecList(treenode* node, attri* val, mempara** memAttri);
void parseStructDec(treenode* node, attri* val, mempara** memAttri);
void parseStructVarDec(treenode* node, attri* val, mempara** memAttri);
char* parseTag(treenode* node);
char* parseOptTag(treenode* node);
void parseDefVarDec(treenode* node, attri* val);
void parseVarList(treenode* node, mempara** paraAttri);
void parseDefList(treenode* node);
void parseStmtList(treenode* node, attri* retType);
void parseParamDec(treenode* node, mempara** paraAttri);
void parseFuncVarDec(treenode* node, attri* val, mempara** paraAttri);
void parseDef(treenode* node);
void parseDecList(treenode* node, attri* val);
void parseDec(treenode* node, attri* val);
void parseStmt(treenode* node, attri* retType);
attri* parseExp(treenode* node);
bool parseArgs(treenode* node, mempara* paraAttri, char* funcName);

void semanticAnalysis(treenode* node);


#endif